<h1>Editing roles_user</h1>

<% form_for(@roles_user) do |f| %>
  <%= f.error_messages %>
  <p>
    <%= f.label :user_id %><br />
    <select name="roles_user[user_id]">
    <% @user.each do |user| %>
		<%if user.id==@roles_user.user_id %>
      <option selected value="<%= user.id %>">
			<%= user.name %>
      </option>
    <%
    else
    %>
      <option value="<%= user.id %>">
			<%= user.name %>
      </option>
    <% end %>
    <% end %>
    </select>
  </p>
  <p>
    <%= f.label :role_id %><br />
    <select name="roles_user[role_id]">
    <% @role.each do |role| %>
		<%if role.id==@roles_user.role_id %>
      <option selected value="<%= role.id %>">
			<%= role.name %>
      </option>
    <%
    else
    %>
      <option value="<%= role.id %>">
			<%= role.name %>
      </option>
    <% end %>
    <% end %>
    </select>
  </p>
    <%= f.submit 'Update' %>
  </p>
<% end %>

<%= link_to 'Show', @roles_user %> |
<%= link_to 'Back', roles_users_path %>